home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2002 November / CD 1 / APC0211D1.ISO / workshop / prog / files / ActivePerl-5.6.1.633-MSWin32.msi / _f21c0cb3b5835e32e80b0caa9d34c051 < prev    next >
Encoding:
Text File  |  2002-05-30  |  1022 b   |  32 lines

  1. # form.pl
  2.  
  3. use vars qw/$TOP/;
  4.  
  5. sub form {
  6.  
  7.     # Create a top-level window that displays a bunch of entries with 
  8.     # tabs set up to move between them.
  9.  
  10.     my($demo) = @_;
  11.     $TOP = $MW->WidgetDemo(
  12.         -name     => $demo,
  13.         -text     => 'This window contains a simple form where you can type in the various entries and use tabs to move circularly between the entries.',
  14.         -title    => 'Form Demonstration',
  15.         -iconname => 'form',
  16.     );
  17.     my $f = $TOP->Frame->pack(-fill => 'both');
  18.     my $row = 0;
  19.     foreach ('Name:', 'Address:', '', '', 'Phone:') {
  20.     my $e = $f->Entry(qw/-relief sunken -width 40/);
  21.     my $l = $f->Label(-text => $_, -anchor => 'e', -justify => 'right');
  22.         Tk::grid( $l, -row => $row, -column => 0, -sticky => 'e');
  23.         Tk::grid( $e, -row => $row++, -column => 1,-sticky => 'ew');
  24.         $f->gridRowconfigure(1,-weight => 1);  
  25.     $e->focus if $_ eq 'Name:';
  26.     }
  27.     $TOP->bind('<Return>' => [$TOP => 'destroy']);
  28.  
  29. } # end form
  30.  
  31. 1;
  32.